package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.LinkBean;
import com.project.mapper.ILinkMapper;
import com.project.service.ILinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class LinkServiceImpl implements ILinkService {
    @Autowired
    private ILinkMapper mapper;

    @Override
    public void add(LinkBean link) {
        mapper.add(link);
    }

    @Override
    public void del(int id) {
        mapper.del(id);
    }

    @Override
    public void update(int id, String phone) {
        mapper.update(id,phone);
    }

    @Override
    public LinkBean findById(int id) {
        return mapper.findById(id);
    }

    @Override
    public PageInfo<LinkBean> findAll(int pageNO) {
        PageHelper.startPage(pageNO,3);
        PageInfo<LinkBean> pageInfo = PageInfo.of(mapper.findAll());

        return pageInfo;
    }
}
